{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">系统配置</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" action="{:url('admin/system/updateAccountConfig')}" method="post">
<!--                    <div class="layui-form-item">-->
<!--                        <label class="layui-form-label">价格</label>-->
<!--                        <div class="layui-input-block">-->
<!--                            <input type="text" name="account_config[money]" value="{$account_config.money|default=''}" placeholder="请输入价格" autocomplete="off" class="layui-input" required lay-verify="required">-->
<!--                        </div>-->
<!--                    </div>-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">客服手机号</label>
                        <div class="layui-input-block">
                            <input type="text" name="account_config[mobile]" value="{$account_config.mobile|default=''}" placeholder="请输入客服手机号" autocomplete="off" class="layui-input" required lay-verify="required">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">客服微信号</label>
                        <div class="layui-input-block">
                            <input type="text" name="account_config[wx]" value="{$account_config.wx|default=''}" placeholder="请输入客服微信号" autocomplete="off" class="layui-input" required lay-verify="required">
                        </div>
                    </div>
<!--                    <div class="layui-form-item">-->
<!--                        <label class="layui-form-label">微信二维码</label>-->
<!--                        <div class="layui-input-block">-->
<!--                            <input type="text" name="account_config[wx_code]" value="{$account_config.wx_code|default=''}" placeholder="请上传图片" class="layui-input layui-input-inline" readonly required>-->
<!--                            <input type="file" name="file" class="layui-upload-file" data-type="0">-->
<!--                        </div>-->
<!--                        <div class="layui-input-block">-->
<!--                            <a href="{$img_url}{$account_config.wx_code|default=''}" target="_blank" id="a_wx_code"><img src="{$img_url}{$account_config.wx_code|default=''}" style="width: 60px;height: 60px;" id="img_wx_code"></a>-->
<!--                        </div>-->
<!--                    </div>-->
                    <!--<div class="layui-form-item">-->
                        <!--<label class="layui-form-label">内容</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<textarea name="account_config[agreement]" class="layui-textarea" id="content"></textarea>-->
                        <!--</div>-->
                    <!--</div>-->
                    <!--<div class="layui-form-item">-->
                        <!--<label class="layui-form-label">付款方式</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<input type="checkbox" name="account_config[pay_type][]" value="1" title="积分" {in name="1" value=""} checked="checked"{/in}>-->
                            <!--<input type="checkbox" name="account_config[pay_type][]" value="2" title="钱包" {in name="2" value=""} checked="checked"{/in}>-->
                        <!--</div>-->
                    <!--</div>-->
                    <!--<div class="layui-form-item">-->
                        <!--<label class="layui-form-label">积分兑换比例（多少积分顶 1元）</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<input type="text" name="account_config[ratio]" value="{$account_config.ratio|default=''}" placeholder="请输入比例" autocomplete="off" class="layui-input" required lay-verify="required">-->
                        <!--</div>-->
                    <!--</div>-->
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="*">提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
    $(function(){
        $('.layui-upload-file').click(function () {
            var id=this.dataset.type;
            layui.upload({
                url: "/index.php/api/upload/upload",
                type: 'image',
                ext: 'jpg|png|gif|bmp',
                success: function (data) {
                    if (data.error === 0) {
                        if(id=='0'){
                            $("input[name='account_config[wx_code]']").val(data.url);
                            $("#a_wx_code").attr('href','{$img_url}'+data.url);
                            $("#img_wx_code").attr('src','{$img_url}'+data.url);
                        }else if(id=='1'){
                            $("input[name='image[1]']").val(data.url);
                        }else if(id=='2'){
                            $("input[name='image[2]']").val(data.url);
                        }
                    } else {
                        layer.msg(data.message);
                    }
                }
            });
        });
    });
</script>
{/block}
{block name="js"}
<script src="__JS__/ueditor/ueditor.config.js"></script>
<script src="__JS__/ueditor/ueditor.all.min.js"></script>
{/block}
{block name="script"}
<script>
    var ue = UE.getEditor('content');
</script>
{/block}
